﻿#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<assert.h>
#include<Windows.h>


//#include<string>
//#include<iostream>
//#include<stack>
//#include<queue>
//using namespace std;




#include <stdio.h>
#include <stdbool.h>

bool isUsed[10];
int result[10];
int n;

void func(int index) {
    if (index == n + 1) {
        for (int i = 1; i <= n; i++) {
            printf("%d ", result[i]);
        }
        printf("\n");
        return;
    }

    for (int i = 1; i <= n; i++) {
        if (!isUsed[i]) {
            result[index] = i;
            isUsed[i] = true;
            func(index + 1);
            isUsed[i] = false;
        }
    }
}

int main() {
    printf("输入一个数 n: ");
    scanf("%d", &n);
    printf("n对应的全排列为:\n");
    func(1);
    return 0;
}




























